<template>
	<view>
		<view class="totalBox">
			<view class="iconTop">
				<uni-icons type="arrowleft" size="25" @click="backShop"></uni-icons>
				<text>商品分类</text>
			</view>
			<uni-search-bar radius="10" />
			<view class="list">
				<view class="zquList">
					<text v-for="(item, index) in zhuanqu" :key="index" :class="defaultIndex == item.id ? 'zqClick' : ''" @click="changeColor(item.id)">{{ item.name }}</text>
				</view>
				<view class="rightBox">
					<specific ref="specific"></specific>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcons from "@/components/uni-icons/uni-icons.vue";
	import uniSearchBar from "@/components/uni-search-bar/uni-search-bar.vue";
	import specific from "./components/specific.vue"
	export default {
		components: {
			// 图标
			uniIcons,
			// 搜索框
			uniSearchBar,
			// 具体的分类
			specific,
		},
		data() {
			return {
				zhuanqu: [
					{
						id: 0,
						name: "汪星人专区",
					},{
						id: 1,
						name: "喵星人专区",
					},{
						id: 2,
						name: "水星人专区",
					},{
						id: 3,
						name: "爬行星专区",
					},{
						id: 4,
						 name: "飞行星专区",
					},{
						id: 5,
						name: "品牌专区",
					}
				],
				defaultIndex: 0,
			}
		},
		methods: {
			backShop() {
				uni.switchTab({
					url: "/pages/shopping/shopping"
				})
			},
			changeColor(listId) {
				this.defaultIndex = listId;
				this.$refs.specific.getCommod(listId);
			}
		}
	}
</script>

<style>
.totalBox {
	/* padding-top: 35px; */
	/* position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 99999; */
}
.totalBox > view:not(:nth-of-type(3)) {
	/* background-color: #ffffff; */
}
.iconTop {
	padding: 16rpx;
	padding-top: 35px;
	position: relative;
	/* width: 100%; */
	height: 100rpx;
	display: flex;
	/* justify-content: center; */
	align-items: center;
	background-color: #FED501;
	color: #FFFFFF !important;
}
.iconTop > text:nth-child(1) {
	margin-right: 8px;
}
.iconTop > text:nth-child(2) {
	font-size: 40rpx;
	font-weight: bold;
}
/* 专区列表 */
.zquList {
	display: flex;
	flex-flow: column wrap;
	align-items: center;
	width: 160px;
	border-right: 2rpx solid #e8e8e8;
}
.zquList > text {
	width: 100%;
	height: 120rpx;
	text-align: center;
	line-height: 120rpx;
	font-size: 30rpx;
}
.zqClick {
	background-color: #FED501;
	color: #FFFFFF;
}
.list {
	display: flex;
	flex-wrap: nowrap;
	justify-content: space-between;
}
.rightBox {
	margin-top: 29.5px;
}
</style>
